package com.topone.Utils;


import java.math.BigDecimal;

public class MathUtil {

    private static final Double MONEY_RANGE = 0.01;

    public static boolean equal(Double data1, Double data2) {
        Double result = Math.abs(data1 - data2);
        if (result < MONEY_RANGE) {
            return true;
        } else {
            return false;
        }
    }
    public static Integer Yuan2Fen(Double yuan) {
        return (new BigDecimal(yuan)).movePointRight(2).intValue();
    }

    public static Double Fen2Yuan(Integer yuan) {
        return (new BigDecimal(yuan)).movePointLeft(2).doubleValue();
    }
    public static boolean compareTo(Double data1, Double data2) {
        Double result = data1 - data2;
        if (result >= 0) {
            return true;
        } else {
            return false;
        }
    }

}
